package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	ItemAttributeEventNew           = "wms.ItemAttributeNew"
	ItemAttributeEventBeforeCreate  = "wms.ItemAttributeBeforeCreate"
	ItemAttributeEventBeforeUpdate  = "wms.ItemAttributeBeforeUpdate"
	ItemAttributeEventBeforeSave    = "wms.ItemAttributeBeforeCreate wms.ItemAttributeBeforeUpdate"
	ItemAttributeEventAfterCreate   = "wms.ItemAttributeAfterCreate"
	ItemAttributeEventAfterUpdate   = "wms.ItemAttributeAfterUpdate"
	ItemAttributeEventAfterSave     = "wms.ItemAttributeAfterCreate wms.ItemAttributeAfterUpdate"
	ItemAttributeEventDelete        = "wms.ItemAttributeDelete"
	ItemAttributeAccessControlEvent = "wms.ItemAttributeAccessControl"
)

func GetItemAttributeConfig() *mgo.DocConfig {
	return ItemAttribute_Config
}

var ItemAttribute_Config *mgo.DocConfig

func init() {
	ItemAttribute_Config = NewItemAttributeConfig()
}
func NewItemAttributeConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "wms.ItemAttribute",
		Fields: []string{
			"itemBase", "attribute", "name", "values", "code", "sort",
		},
		RelationFields: []string{
			"itemBase", "attribute",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"itemBase": {
				Config:     GetItemBaseConfig,
				DocName:    "ItemBase",
				JoinType:   "O",
				KeyInside:  "itemBaseId",
				KeyOutSide: "id",
			},
			"attribute": {
				Config:     GetAttributeKeyConfig,
				DocName:    "AttributeKey",
				JoinType:   "O",
				KeyInside:  "attributeId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
